<!--
  @author linfeng
  @since 2020/02/13 08:59
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common :: jscss">
    <title>标准内容</title>
</head>
<body>
<div class="layui-fluid">
    <blockquote class="layui-crumb">
        标准规范>
        <a lay-href="/standard/record/list.action">管理标准规范</a>>
        <zmn>[[${standardRecord.title}]]</zmn>
    </blockquote>

    <div class="layui-card">
        <div th:replace="standard/record/_tab::tab"></div>

        <div class="layui-card-body">
            <form method="post" action="" class="layui-form" lay-filter="zmn-form">
                <input type="hidden" name="standardId" th:value="${standardRecord.standardId}"/>
                <div class="layui-form-item">
                    <script id="content" width="900px" height="500px" name="content" type="text/plain">
                    </script>
                </div>

                <div class="layui-form-item">
                    <label style="margin-left: 5px;text-align: left;width: 60px;display: block;float: left">附件：</label>

                    <div id="files">
                        <div th:if="${standardRecord.fileSrc != null && standardRecord.fileSrc != ''}" id="file">
                            <div style="margin-left: 70px;" class="layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="fileSrc" id="fileSrc" th:href="${standardRecord.fileSrc}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(standardRecord.fileSrc)}" class="layui-form-label uploadFile" style="width: auto;" download="">我是文件名</a>
                                    <span th:value="${standardRecord.fileSize}" id="fileSize" class="layui-form-label" th:text="${#numbers.formatDecimal(standardRecord.fileSize*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" onclick="deleteFile('fileSrc')" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                            </div>
                            <div class="layui-split">&nbsp;</div>
                        </div>

                        <div th:if="${standardRecord.fileSrc2 != null && standardRecord.fileSrc2 != ''}" id="file2">
                            <div style="margin-left: 70px;" class="layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="fileSrc2" id="fileSrc2" th:href="${standardRecord.fileSrc2}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(standardRecord.fileSrc2)}" class="layui-form-label uploadFile" style="width: auto;" download="">我是文件名</a>
                                    <span th:value="${standardRecord.fileSize2}" id="fileSize2" class="layui-form-label" th:text="${#numbers.formatDecimal(standardRecord.fileSize2*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" onclick="deleteFile('fileSrc2')" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                            </div>
                            <div class="layui-split">&nbsp;</div>
                        </div>

                        <div th:if="${standardRecord.fileSrc3 != null && standardRecord.fileSrc3 != ''}" id="file3">
                            <div style="margin-left: 70px;" class="layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="fileSrc3" id="fileSrc3" th:href="${standardRecord.fileSrc3}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(standardRecord.fileSrc3)}" class="layui-form-label uploadFile" style="width: auto;" download="">我是文件名</a>
                                    <span th:value="${standardRecord.fileSize3}" id="fileSize3" class="layui-form-label" th:text="${#numbers.formatDecimal(standardRecord.fileSize3*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" onclick="deleteFile('fileSrc3')" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                            </div>
                            <div class="layui-split">&nbsp;</div>
                        </div>

                        <div th:if="${standardRecord.fileSrc4 != null && standardRecord.fileSrc4 != ''}" id="file4">
                            <div style="margin-left: 70px;" class="layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="fileSrc4" id="fileSrc4" th:href="${standardRecord.fileSrc4}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(standardRecord.fileSrc4)}" class="layui-form-label uploadFile" style="width: auto;" download="">我是文件名</a>
                                    <span th:value="${standardRecord.fileSize4}" id="fileSize4" class="layui-form-label" th:text="${#numbers.formatDecimal(standardRecord.fileSize4*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" onclick="deleteFile('fileSrc4')" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                            </div>
                            <div class="layui-split">&nbsp;</div>
                        </div>

                        <div th:if="${standardRecord.fileSrc5 != null && standardRecord.fileSrc5 != ''}" id="file5">
                            <div style="margin-left: 70px;" class="layui-input-block">
                                <div class="layui-input-inline" style="width: auto">
                                    <a name="fileSrc5" id="fileSrc5" th:href="${standardRecord.fileSrc5}" th:text="${T(com.zmn.plat.business.impl.upload.UrlUtils).getUrlFileName(standardRecord.fileSrc5)}" class="layui-form-label uploadFile" style="width: auto;" download="">我是文件名</a>
                                    <span th:value="${standardRecord.fileSize5}" id="fileSize5" class="layui-form-label" th:text="${#numbers.formatDecimal(standardRecord.fileSize5*1.0/1024, 1, 2)+'KB'}" style="width: auto; color: #9F9F9F;">16.66KB</span>
                                    <a class="layui-form-label" onclick="deleteFile('fileSrc5')" style="width:auto;color: #00a0e9">
                                        删除
                                    </a>
                                </div>
                            </div>
                            <div class="layui-split">&nbsp;</div>
                        </div>
                    </div>

                    <div style="margin-left: 70px;" class="layui-input-block">
                        <div class="layui-input-inline">
                            <a href="javascript:void(0)" id="upload" style="color: #00a0e9">
                                &nbsp;&nbsp;&nbsp;&nbsp;+添加文件
                            </a>
                        </div>
                    </div>
                </div>

                <div class="layui-split">&nbsp;</div>
                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button th:if="${#authPermit.checkPermit('/standard/record/addEditContent.action')}" class="layui-btn" lay-submit="" lay-filter="zmn-form-preView-submit">
                            预览
                        </button>
                        <button th:if="${#authPermit.checkPermit('/standard/record/addEditContent.action')}" class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">下一步</button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>

</body>
</html>

<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" th:inline="javascript">
    var ue = UE.getEditor('content', {
        initialFrameHeight:500,
        initialFrameWidth:900
    });

    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        // 这里很重要，很重要，很重要，要和配置中的imageActionName值一样
        if (action == 'uploadimage') {
            // 这里调用后端我们写的图片上传接口
            return '/ueditor/uploadImageData';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    }

    let value = [[${standardRecord.content}]];
    ue.ready(function () {
        ue.execCommand('insertHtml', value);
    });
</script>

<script type="text/javascript">
    function insertHtml() {
        var value = prompt('插入html代码', '');
        UE.getEditor('content').execCommand('insertHtml', value)
    }

    function getContent() {
        var arr = [];
        arr.push(UE.getEditor('content').getContent());
        return(arr.join("\n"));
    }
</script>

<script type="text/javascript" th:inline="javascript">
    var json = {
        standardRecord: [[${standardRecord}]]
    };
    layui.config({
        base: "/static/lay/",
        version:2020021300000
    }).extend({
        index: "lib/index",
        standard_record_content_edit_js: "standard/record/zmn.plat.standard.record.content.edit"
    }).use(['index', 'standard_record_content_edit_js']);
</script>